import tkinter as tk
from tkinter import ttk
from src.ui.tkinter.styles.colors import (
    BACKGROUND_MAIN, TEXT_MAIN, TEXT_ACCENT,
    BUTTON_NORMAL, BUTTON_HOVER, BUTTON_CANCEL,
    INPUT_BACKGROUND
)

def create_main_window() -> tk.Tk:
    """Create and configure the main window"""
    root = tk.Tk()
    root.title("TFboys' Bakery - Magic Bread Manager")
    root.geometry("800x600")
    root.resizable(False, False)
    root.config(bg=BACKGROUND_MAIN)

    style = ttk.Style(root)
    style.theme_use("clam")  

    style.configure(
        "Title.TLabel",
        background=BACKGROUND_MAIN,
        foreground=TEXT_ACCENT,
        font=("Arial", 24, "bold")
    )

    style.configure(
        "Main.TLabel",
        background=BACKGROUND_MAIN,
        foreground=TEXT_MAIN,
        font=("Arial", 12)
    )

    style.configure(
        "Normal.TButton",
        background=BUTTON_NORMAL,
        foreground="white",
        font=("Arial", 11),
        padding=(15, 5)  
    )

    style.map(
        "Normal.TButton",
        background=[("active", BUTTON_HOVER)],
        foreground=[("active", "white")]
    )

    style.configure(
        "Cancel.TButton",
        background=BUTTON_CANCEL,
        foreground=TEXT_MAIN,
        font=("Arial", 11),
        padding=(15, 5)
    )

    style.configure(
        "Main.TEntry",
        fieldbackground=INPUT_BACKGROUND,
        font=("Arial", 11),
        padding=(5, 3)
    )

    style.configure("Transparent.TFrame", background=BACKGROUND_MAIN)

    return root